 var urlData = require('../../../../../data/url.js');

Page({
  /**
   * 页面的初始数据
   */
  data: {
    userId: '',
    itemArray:[],
    danxuan: '',
    onloadUrl: urlData.urlList.teachingManage.leaveManageSelecestudent.url,
    onloadUrlPost: urlData.urlList.teachingManage.leaveManageSelecestudentPost.url
  },
  /**
   * 生命周期函数--监听页面加载
   */
  onLoad: function (options) {
    var that = this;
    wx.getStorage({//获取缓存
      key: "loginConf",
      success: function (res) {
        that.setData({
          userId: res.data.userId
        });//刷数据
        wx.request({
          url: that.data.onloadUrl,
          method: "get",
          data: {
            user_id: that.data.userId
          },
          header: {
            'content-type': 'application/x-www-form-urlencoded'
          },
          success: function (res) {
            if (res.data.code == 0) {
              that.listData(res);
            }
          },
          fail: function (res) {
            console.log('刷list数据失败');
          }
        });
      }
    });
  }, 
  //刷数据
  listData: function (res) {
    this.setData({
      itemArray: res.data.list
    });

  },
  radioChange: function (e) {
    this.setData({
      danxuan: e.detail.value
    })
  },
  tapNamefir: function (e) {//提交按钮
    wx.setStorage({
      key:'submitCourse',
      data:{
        course_id:this.data.danxuan
      }
    });
    wx.navigateTo({
      url: '../../leave-manage/leave-manage-student/leave-manage-student'
    })
  }
  
  
})